﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Blizzard.Contracts;
using Blizzard.Interceptors;

namespace Blizzard.Test.DataObjectsII
{
    [Mapper(Table = "[DataObjectsII C]")]
    public class C : IDataObject
    {
        private Interceptor _interceptor;
        [Mapper(Field = "ID", IsIdentityColumn = true)]
        public int Id { get; set; }

        private string _name;
        [Mapper(Field = "Name")]
        public string Name
        {
            get
            {
                _interceptor.Intercept(this, "Name", false);
                return _name;
            }
            set
            {
                _interceptor.Intercept(this, "Name", true, _name, value);
                _name = value;
            }
        }


        

        private B _b;
        [Mapper(Field = "[B ID]", Composition = true)]
        public B b
        {
            get 
            {
                _interceptor.Intercept(this, "b", false);
                return _b; 
            }
            set 
            {
                _interceptor.Intercept(this, "b", true, _b, value);
                _b = value; 
            }
        }


        public Container.BlizzardManager Manager
        {
            set { _interceptor = new Interceptor(value); }
        }
    }
}
